package com.meshnetics.gb.stack.core;

import com.meshnetics.gb.type.impl.custom.FiniteEnumerationElement;

/**
 * Status for stack events. It's expected that layer's statuses will extend it and TypeStackStatus.
 *
 * @author Liliya Butorina
 * @author mmarkov
 */
public class StackStatus extends FiniteEnumerationElement {
    /** Common for all layers success status. */
    public static final StackStatus SUCCESS = new StackStatus(TypeStackStatus.TYPE, 0x00, "SUCCESS");

    /**
     * Constructs StackStatus having the given type, code and name.
     *
     * @param type TypeStackStatus type
     * @param code long code (unique withing one type)
     * @param name name of status
     */
    protected StackStatus(TypeStackStatus type, long code, String name) {
        super(type, code, name);
    }

    /**
     * Returns the code of this StackStatus.
     *
     * @return the code of this StackStatus
     */
    public byte getCode() {
        return value[0];
    }
}
